package main

/**
 *
 * @param prices int整型一维数组
 * @return int整型
 */
func maxProfit(prices []int) int {
	// write code here
	var min int = 1e9
	max := 0
	for _, price := range prices {
		if max < price-min {
			max = price - min
		}
		if min > price {
			min = price
		}
	}
	return max
}
